package com.atguigu.a_operator;

public class Demo5 {
    public static void main(String[] args) {
        int a = 10;
        int b = 20;

        System.out.println(a == b);//false
        System.out.println(a = b);//20


        //常量可以共享
        String name1 = "张三";//001
        String name2 = "张三";//001
        //只要new 就开新空间
        String name3 = new String("张三");//0x002
        String name4 = new String("张三");//0x003
        System.out.println("name1 = " + name1);
        System.out.println("name2 = " + name2);
        System.out.println("name3 = " + name3);
        System.out.println("name4 = " + name4);

        System.out.println(name1 == name2);//比地址值 -> true
        System.out.println(name1 == name3);//比地址值 -> false
        System.out.println(name2 == name3);//比地址值 -> false

        System.out.println(name3 == name4);//
    }
}
